import request from "@/utils/request";
import { stringify } from "qs";

const prefix = "/new-goods";

// /new-goods/member/apply/list
// 会员价申请列表 状态： 0 待审核 1 使用中 2 失败 3 作废
export async function queryMemberPriceApplyList(params, defaultParams = { status: 1 }) {
	return request(`${prefix}/member/apply/list?${stringify({ ...params, ...defaultParams })}`, {
		loading: true
	});
}

// 拿货员列表
export async function queryTakeUserList(params = {}) {
	return request(`/blade-user/childUsers?${stringify(params)}`);
}

// /new-goods/member/apply/log/list
// 会员价申请日志
export async function queryMemberPriceApplyLogList(params) {
	return request(`${prefix}/member/apply/log/list?${stringify(params)}`, {
		loading: true
	});
}

// /new-goods/member/apply/auditing
// 会员价申请审核
export async function auditingMemberPriceApply(params) {
	return request(`${prefix}/member/apply/auditing`, {
		method: "post",
		data: params
	});
}

// 新增商品列表
export async function getGoodsSkuPage(params, defaultParams = { isExactMatch: 1 }) {
	return request(`/new-goods/goods/sku/list`, {
        method: "Post",
		data: { ...params, ...defaultParams },
		loading: true
	});
}

// 新增商品列表，去除defaultParams
export async function getGoodsSkuPageNodeNoDefaultParams(params) {
	return request(`/new-goods/goods/sku/list`, {
        method: "Post",
		data: { ...params },
		loading: true
	});
}

// 会员价申请提交
export async function submitMemberPriceApply(params) {
	return request(`${prefix}/member/apply/submit`, {
		method: "post",
		data: params,
		loading: true
	});
}

// 获取配置信息
export async function getChangePriceConfigInfo(params) {
	return request(`${prefix}/change-price-config/get-info?${stringify(params)}`, {
		loading: true
	});
}

// 提交配置
export async function submitChangePriceConfig(params) {
	return request(`${prefix}/change-price-config/submit`, {
		method: "post",
		data: params,
		loading: true
	});
}

// 获取配置日志
export async function getChangePriceConfigLogList(params) {
	return request(`${prefix}/change-price-config-log/list?${stringify(params)}`, {
		loading: true
	});
}

// 下载模板
export async function getImportTemplateUrl(params) {
	return request(`/blade-log/taskInfo/getImportTemplateUrl?${stringify(params)}`, { loading: true });
}

// //获取列表分页
// export async function queryPageSkuList(params) {
// 	return request(`${prefix}/ec-goods-sku/search-ecgoodssku-by-page?${stringify(params)}`, {
// 		loading: true
// 	});
// }

// 操作人列表
export async function queryOperationList(params) {
	return request(`/blade-user/user/getUserListByUuid`, {
		method: "post",
		data: params,
		loading: true
	});
}